local fengyin1 = fk.CreateSkill {
  name = "fengyin1",
  tags = { Skill.Compulsory,Skill.Permanent},
}

Fk:loadTranslationTable{
  ["fengyin1"] = "封印",
  [":fengyin1"] = "锁定技，持恒技，你的手牌恒为0。当你即将死亡时，若你的体力上限不大于7，则改为休整一轮，此后你增加1点体力上限",
}
fengyin1:addEffect(fk.BeforeGameOverJudge, {
  mute = true,
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(fengyin1.name, false, true) and
      player.maxHp <= 6
  end,
  on_use = function (self, event, target, player, data)
    player._splayer:setDied(false)
    local room = player.room
    room:changeMaxHp(player, 1)
    player.room:setPlayerRest(player, 1)
    

  end,
})
fengyin1:addEffect(fk.GameStart, {
  anim_type = "defensive",
  mute=true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(fengyin1.name) and player:getHandcardNum() ~= 0
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local num = 0 - player:getHandcardNum()
    if num > 0 then
      player:drawCards(num, fengyin1.name)
    elseif num < 0 then
      room:askToDiscard(player, {
        min_num = -num,
        max_num = -num,
        include_equip = false,
        skill_name = fengyin1.name,
        cancelable = false,
      })
    end
  end,
})



fengyin1:addEffect(fk.AfterCardsMove, {
  anim_type = "defensive",
  mute=true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(fengyin1.name) and player:getHandcardNum() ~= 4
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local num = 0 - player:getHandcardNum()
    if num > 0 then
      player:drawCards(num, fengyin1.name)
    elseif num < 0 then
      room:askToDiscard(player, {
        min_num = -num,
        max_num = -num,
        include_equip = false,
        skill_name = fengyin1.name,
        cancelable = false,
      })
    end
  end,
})


return fengyin1


